package sj;

import entity.Person;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class demo3 {
    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException {

        Class clz= Person.class;

        Object person=clz.newInstance();

        Method silentMethod=clz.getDeclaredMethod("silentMethod");
        silentMethod.setAccessible(true);

        silentMethod.invoke(person,null);

        Method age=clz.getDeclaredMethod("getAge",null);

        age.setAccessible(true);
        Object invoke = age.invoke(person, null);
        System.out.println("age"+invoke);


    }
}
